static void xcinfo2xlinfo(const xc_domaininfo_t *xcinfo,
struct libxl_dominfo *xlinfo)
{
- unsigned int shutdown_reason;
-
memcpy(&(xlinfo->uuid), xcinfo->handle, sizeof(xen_domain_handle_t));
xlinfo->domid = xcinfo->domain;
xlinfo->paused = !!(xcinfo->flags&XEN_DOMINF_paused);
xlinfo->blocked = !!(xcinfo->flags&XEN_DOMINF_blocked);
xlinfo->running = !!(xcinfo->flags&XEN_DOMINF_running);
- xlinfo->crashed = 0;
-
- shutdown_reason = (xcinfo->flags>>XEN_DOMINF_shutdownshift) & XEN_DOMINF_shutdownmask;
- if ( xlinfo->shutdown && (shutdown_reason == SHUTDOWN_crash) ) {
- xlinfo->shutdown = 0;
- xlinfo->crashed = 1;
- }
+ if (xlinfo->shutdown || xlinfo->dying)
+ xlinfo->shutdown_reason = (xcinfo->flags>>XEN_DOMINF_shutdownshift) & XEN_DOMINF_shutdownmask;
+ else
+ xlinfo->shutdown_reason = ~0;
xlinfo->max_memkb = PAGE_TO_MEMKB(xcinfo->tot_pages);
xlinfo->cpu_time = xcinfo->cpu_time;
uint8_t blocked:1;
uint8_t paused:1;
uint8_t shutdown:1;
- uint8_t crashed:1;
uint8_t dying:1;
+
+ /*
+ * Valid SHUTDOWN_* value from xen/sched.h iff (shutdown||dying).
+ *
+ * Otherwise set to a value guaranteed not to clash with any valid
+ * SHUTDOWN_* constant.
+ */
+ unsigned int shutdown_reason;
+
uint64_t max_memkb;
uint64_t cpu_time;
uint32_t vcpu_max_id;
info[i].blocked ? 'b' : '-',
info[i].paused ? 'p' : '-',
info[i].shutdown ? 's' : '-',
- info[i].crashed ? 'c' : '-',
+ info[i].shutdown_reason == SHUTDOWN_crash ? 'c' : '-',
info[i].dying ? 'd' : '-',
((float)info[i].cpu_time / 1e9));
if (verbose) {